package com.mairuide._frame.utils;

import java.io.IOException;
import java.util.Scanner;

/**
 * @Description
 * @auther 刘中华
 * @create 2019-01-24 17:18
 * 得到cpu的序列号
 */
public class CpuUtils {
    public static String getCpuId() {
        String serial = null;
        try {
            Process process = Runtime.getRuntime().exec(
                    new String[] { "wmic", "cpu", "get", "ProcessorId" });
            process.getOutputStream().close();
            Scanner sc = new Scanner(process.getInputStream());
            sc.next();
            serial = sc.next();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return serial;
    }
}
